#include <fermat/libhttp/http_method.h>

namespace fermat {
namespace libhttp {

    const HttpMethod HttpMethod::of ( const ::http_parser& parser )
    {
        return (static_cast< ::http_method >(parser.method));
    }

    const HttpMethod HttpMethod::del ()
    {
        return (HTTP_DELETE);
    }

    const HttpMethod HttpMethod::get ()
    {
        return (HTTP_GET);
    }

    const HttpMethod HttpMethod::head ()
    {
        return (HTTP_HEAD);
    }

    const HttpMethod HttpMethod::post ()
    {
        return (HTTP_POST);
    }

    const HttpMethod HttpMethod::put  ()
    {
        return (HTTP_PUT);
    }

    const HttpMethod HttpMethod::connect ()
    {
        return (HTTP_CONNECT);
    }

    const HttpMethod HttpMethod::options ()
    {
        return (HTTP_OPTIONS);
    }

    const HttpMethod HttpMethod::trace ()
    {
        return (HTTP_TRACE);
    }

    const HttpMethod HttpMethod::copy ()
    {
        return (HTTP_COPY);
    }

    const HttpMethod HttpMethod::lock ()
    {
        return (HTTP_LOCK);
    }

    const HttpMethod HttpMethod::mkcol ()
    {
        return (HTTP_MKCOL);
    }

    const HttpMethod HttpMethod::move ()
    {
        return (HTTP_MOVE);
    }

    const HttpMethod HttpMethod::propfind ()
    {
        return (HTTP_PROPFIND);
    }

    const HttpMethod HttpMethod::proppatch ()
    {
        return (HTTP_PROPPATCH);
    }

    const HttpMethod HttpMethod::unlock ()
    {
        return (HTTP_UNLOCK);
    }

    const HttpMethod HttpMethod::report ()
    {
        return (HTTP_REPORT);
    }

    const HttpMethod HttpMethod::mkactivity ()
    {
        return (HTTP_MKACTIVITY);
    }

    const HttpMethod HttpMethod::checkout ()
    {
        return (HTTP_CHECKOUT);
    }

    const HttpMethod HttpMethod::merge ()
    {
        return (HTTP_MERGE);
    }

    const HttpMethod HttpMethod::msearch ()
    {
        return (HTTP_MSEARCH);
    }

    const HttpMethod HttpMethod::notify ()
    {
        return (HTTP_NOTIFY);
    }

    const HttpMethod HttpMethod::subscribe ()
    {
        return (HTTP_SUBSCRIBE);
    }

    const HttpMethod HttpMethod::unsubscribe ()
    {
        return (HTTP_UNSUBSCRIBE);
    }

    const HttpMethod HttpMethod::patch ()
    {
        return (HTTP_PATCH);
    }

    HttpMethod::HttpMethod ( Value value )
        : _value(value)
    {
    }

    bool HttpMethod::operator== ( const HttpMethod& rhs ) const
    {
        return (_value == rhs._value);
    }

    bool HttpMethod::operator!= ( const HttpMethod& rhs ) const
    {
        return (_value != rhs._value);
    }

    HttpMethod::operator Value () const
    {
        return (_value);
    }

	std::string HttpMethod::toString() const
	{
		return http_method_str(_value);
	}

	
}
}
